package com.zx.kitchen.index.common.mvp.presenter;

import android.content.Context;

import com.zx.kitchen.index.common.entity.IndexOrderBean;
import com.zx.kitchen.index.common.entity.NextDishesListBean;
import com.zx.kitchen.index.common.mvp.OnResultListener;
import com.zx.kitchen.index.common.mvp.model.IndexOrderNextModelImpl;
import com.zx.kitchen.index.common.mvp.view.IndexOrderNextView;

/**
 * Created by Administrator on 2017/3/6.
 */

public class IndexOrderNextPresenter implements OnResultListener {
    private IndexOrderNextModelImpl indexOrderNextModel;
    private IndexOrderNextView indexOrderNextView;
    private Context context;

    public IndexOrderNextPresenter(IndexOrderNextView indexOrderNextView, Context context) {
        this.indexOrderNextView = indexOrderNextView;
        this.context = context;
        indexOrderNextModel = new IndexOrderNextModelImpl();
    }

    public void getFromNet(String fid, int is_last) {
        indexOrderNextModel.getFromNet(1, context, fid, is_last, this, null);
    }

    @Override
    public void onSuccess(int requestCode, String str) {
        IndexOrderBean orderBean = indexOrderNextModel.asyncJson(str);
        indexOrderNextView.onSuccess(orderBean);
    }


    @Override
    public void onFailure(int requestCode, String str) {
        indexOrderNextView.onFail(str);

    }
}
